package top.stmo.blog.admin.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.stmo.blog.admin.model.params.PageParam;
import top.stmo.blog.admin.pojo.Permission;
import top.stmo.blog.admin.service.PermissionService;
import top.stmo.blog.admin.vo.Result;

@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private PermissionService permissionService;

    @PostMapping("/permission/permissionList")
    public Result listPermission(@RequestBody PageParam pageParam) {

        return permissionService.listPermission(pageParam);
    }

    @PostMapping("/permission/add")
    public Result add(@RequestBody Permission permission) {

        return permissionService.add(permission);
    }

    @PostMapping("/permission/update")
    public Result update(@RequestBody Permission permission) {

        return permissionService.update(permission);
    }

    @GetMapping("/permission/delete/{id}")
    public Result delete(@PathVariable Long id) {

        return permissionService.delete(id);
    }

}
